<template>
	<div class="wrapper">
		<!--header部分-->
		<header>
			<div class="back" @click="toWallet">
			<i class="fa fa-chevron-left"></i>
			</div>
			<div class="text">开通账户</div>
		</header>
		<!-- 表单部分 -->
				<ul class="form-box" >
					<li>
						<div class="title">
							账号：
						</div>
						<div class="content" >
							<input type="text" v-model="userwalletArr.userAccount" placeholder="账号">
						</div>
					</li>
					<li>
						<div class="title">
							绑定银行卡号：
						</div>
						<div class="content" >
							<input type="text" v-model="usercartArr.cart" placeholder="绑定银行卡号">
						</div>
					</li>
					<li>
						<div class="title">
							银行卡密码：
						</div>
						<div class="content" >
							<input type="password" v-model="usercartArr.password" placeholder="银行卡密码">
						</div>
					</li>
					
					
				</ul>
				<div class="button-login" @click="kaitong">
					<button >开通</button>
				</div>
	</div>
</template>

<script>
	export default {
		name: 'Account',
		data() {
			return {
				userId:'',
				user: {},
				userwalletArr:[],
				usercartArr:[],
			}
		},
		created(){
			this.user = this.$getSessionStorage('user');
			
			this.$axios.post('UserCartController/listUserCart', this.$qs.stringify({
				
			})).then(response => {
				this.usercartArr = response.data;
				
			}).catch(error => {
				console.error(error);
			});
		},
		methods: {
			kaitong(){
			this.$axios.post('UserWalletController/listUserWalletByUserId', this.$qs.stringify({
				userId:this.user.userId
				})).then(response => {
					let userwallet = response.data;
					this.$setSessionStorage('userwallet',userwallet);
					
				}).catch(error => {
					console.error(error);
				});
			},
			
			toWallet() {
				this.$router.push({
					path: '/my'
				});
			},
			
			
		}
	}
</script>

<style>
	/****************** 总容器 ******************/
	.wrapper {
		width: 100%;
		height: 100%;
		background-color: azure;
	}
	/****************** header ******************/
	.wrapper header{
		width: 100%;
		height: 12vw;
		background-color: #FFF;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		margin-bottom: 1vw;
	}
	.wrapper header .back{
		font-size: 4vw;
		margin-left: 2vw;
		margin-right: 2vw;
	}
	.wrapper header .text{
		font-size: 4vw;
	}
	/****************** 表单部分 ******************/
	.wrapper .form-box {
		width: 100%;
		
	}
	
	.wrapper .form-box li {
		box-sizing: border-box;
		padding: 4vw 3vw 0 3vw;
		display: flex;
		align-items: center;
	}
	
	.wrapper .form-box li .title {
		flex: 0 0 18vw;
		font-size: 3vw;
		font-weight: 700;
		color: #666;
	}
	
	.wrapper .form-box li .content {
		flex: 1;
	}
	
	.wrapper .form-box li .content input {
		border: none;
		outline: none;
		width: 100%;
		height: 4vw;
		font-size: 3vw;
	}
	
	.wrapper .button-login {
		width: 100%;
		box-sizing: border-box;
		padding: 4vw 3vw 0 3vw;
	}
	
	.wrapper .button-login button {
		width: 100%;
		height: 10vw;
		font-size: 3.8vw;
		font-weight: 700;
		color: #fff;
		background-color: #38CA73;
		border-radius: 4px;
		border: none;
		outline: none;
	}
	
	.wrapper .button-register {
		width: 100%;
		box-sizing: border-box;
		padding: 4vw 3vw 0 3vw;
	}
	
	.wrapper .button-register button {
		width: 100%;
		height: 10vw;
		font-size: 3.8vw;
		font-weight: 700;
		color: #666;
		background-color: #EEE;
		border-radius: 4px;
		border: none;
		outline: none;
		border: solid 1px #DDD;
	}
</style>
